package com.cpd.blog.common.utils;

import org.apache.commons.lang3.StringUtils;

/**
 * 参数检查工具类
 *
 * @Author: Copydown
 * @Date: 2022/04/30/1:22
 */
public class CheckUtil {

    public static boolean isTrue(boolean x) {
        return x;
    }

    public static boolean isFalse(boolean x) {
        return !x;
    }

    public static <T> boolean isNull(T t) {
        return t == null;
    }

    public static <T> boolean isNotNull(T t) {
        return t != null;
    }

    public static <T> boolean isEquals(T t1, T t2) {
        return t1.equals(t2);
    }

    public static <T> boolean isNotEquals(T t1, T t2) {
        return !t1.equals(t2);
    }

    public static boolean hasBlank(String... params) {
        for (String s : params) {
            if (StringUtils.isBlank(s)) {
                return true;
            }
        }
        return false;
    }

    public static boolean isBlank(String str) {
        return StringUtils.isBlank(str);
    }
}
